<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html>
<head>
	<meta charset='utf-8' /> 
	<title>创建台账</title>
	<style>
		.cursers{cursor:pointer}
	</style>
</head>
<body style='background:#ddd;padding:0px;margin:0px;padding-left:10px'>


	<div>
		<h1 style='text-align:center'>创建台账</h1>		
	</div>

	<!--台账列表-->
	<div style='text-align:center'>
		<div>台账名称：<input type="text" id='lname' /></div><br>	
		<div>台账表名：<input type="text" id='tname'/></div><br>
		<div>台账描述：<input type="text" id='info'/></div>		

		<div style='margin:20px auto'>
			<button id='addBtn'>提交</button>
			<button onclick='history.go(-1)'>返回</button>
		</div>
	</div>

</body>
</html>
<script src='../public/jquery1.1.js'></script>
<script src='../public/fun.js'></script>
<script>
_checkExit();
$(function(){
	$('#addBtn').click(function(){
		var lname = m_trim($('#lname').val());
		var tname = m_trim($('#tname').val());
		var info = m_trim($('#info').val());
		if(!_checkChar(lname) || !_checkChar(tname) || !_checkChar(info)){
			A('非法字符');return;
		}
		if(!lname || !tname){
			return;
		}
		var data = {
			type:'createLedger',
			lname:lname,
			tname:tname,
			info:info
		}
		AjaxBefore(data,function(res){
			C(res);
			var tmp = _checkJsonFormat(res); //检测JSON格式
			switch(tmp.stat){
				case 'err2': A('台账名或表名已存在！');break;
				case 'err3': A('台账创建失败！');break;
				case 'err4': A('非法字符！');break;
				case 'ok':
					A('台账创建成功！');
					history.go(-1);
				break;
			}
		})
	});
});

</script>

